package com.nbsaas.boot.quartz.rest.convert;

import com.nbsaas.boot.quartz.data.entity.SchedulingTaskRecord;
import com.nbsaas.boot.quartz.api.domain.simple.SchedulingTaskRecordSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 定时任务记录-列表对象转换器
*/

public class SchedulingTaskRecordSimpleConvert implements Converter<SchedulingTaskRecordSimple, SchedulingTaskRecord> {




@Override
public SchedulingTaskRecordSimple convert(SchedulingTaskRecord source) {
    SchedulingTaskRecordSimple result = new SchedulingTaskRecordSimple();

                result.setNote(source.getNote());

               try {
                   if(source.getSchedulingTask()!=null){
                       result.setSchedulingTask(source.getSchedulingTask().getId());
                   }
                } catch (Exception ignored) { }


                try {
                    if(source.getSchedulingTask()!=null){
                        result.setSchedulingTaskName(source.getSchedulingTask().getName());
                    }
                } catch (Exception ignored) { }

                result.setState(source.getState());
                result.setId(source.getId());
                result.setAddDate(source.getAddDate());
                result.setLastDate(source.getLastDate());


    return result;
}

}